<template>
  <view class="setting-container" :style="{ height: `${windowHeight}px` }">
    <view class="menu-list">
      <view class="list-cell list-cell-arrow" @click="handleToUpgrade">
        <view class="menu-item-box">
          <view class="iconfont icon-refresh menu-icon"></view>
          <view>检查更新</view>
        </view>
      </view>
      <view class="list-cell list-cell-arrow" @click="handleCleanTmp">
        <view class="menu-item-box">
          <view class="iconfont icon-clean menu-icon"></view>
          <view>清理缓存</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  onload() {},
  data() {
    return {
      windowHeight: uni.getSystemInfoSync().windowHeight,
      currentSize: "",
    };
  },
  methods: {
    handleToUpgrade() {
      this.$modal.showToast("模块建设中~");
    },
    handleCleanTmp() {
      uni.showModal({
        title: "提示",
        content: "确定清除缓存吗? (注：清除缓存后，需要重新登录)",
        success: function (res) {
          if (res.confirm) {
            uni.clearStorageSync();
            uni.showToast({
              title: "清除成功",
              icon: "none",
            });
          }
        },
      });
    },
    handleLogout() {
      this.$modal.confirm("确定退出系统吗？").then(() => {
        this.$store.dispatch("LogOut").then(() => {
          this.$tab.reLaunch("/pages/index");
        });
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.page {
  background-color: #f8f8f8;
}

.item-box {
  background-color: #ffffff;
  margin: 30rpx;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 10rpx;
  border-radius: 8rpx;
  color: #303133;
  font-size: 32rpx;
}
</style>
